package com.tian.service.impl;

import com.tian.dto.LoanPlainDto;
import com.tian.enums.ResultCode;
import com.tian.service.LoanPlainDubboService;
import com.tian.service.LoanPlainService;
import com.tian.utils.CommonResult;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

/**
 * @author tianwc  公众号：java后端技术全栈、面试专栏
 * @version 1.0.0
 * @date 2023年08月28日 15:20
 * 在线刷题 1200+题和1000+篇干货文章：<a href="https://woaijava.cc/">博客地址</a>
 */
@Service
public class LoanPlainServiceImpl implements LoanPlainService {

    @Reference(version = "1.0.0")
    private LoanPlainDubboService loanPlainDubboService;


    @Override
    public CommonResult<LoanPlainDto> queryById(Long id) {
        CommonResult<LoanPlainDto> loanPlainDtoCommonResult = loanPlainDubboService.queryById(id);
        if (loanPlainDtoCommonResult.getCode() != ResultCode.SUCCESS.getCode()) {
            //一些业务性处理
            return loanPlainDtoCommonResult;
        }
        loanPlainDtoCommonResult.setMessage("查询成功");
        return loanPlainDtoCommonResult;
    }
}
